<template>
<view>
<!--index.wxml-->
<view v-for="(item, index) in goodlist" :key="index" class="team-list">
    <view class="team-item">
        <navigator class="team-pic" :url="'/pages/team/team_info/team_info?goods_id=' + item.goods_id + '&item_id=' + item.item_id + '&team_id=' + item.team_id">
            <image mode="aspectFill" class="wh100" :src="url + '' + item.share_img"></image>
        </navigator>
        <view class="team-name ellipsis-2">{{item.goods_name}}</view>
        <view class="team-des">
            <view class="team-price">
                <view class="team-ico">
                    <view><image class="wh100" src="/static/images/ico-team6.png"></image></view>
                    {{item.needer}}人团
                </view>
                <view class="co-red"><text>￥</text>{{item.team_price}}</view>
                <view>单买￥{{item.spec_goods_price ? item.spec_goods_price.price : item.goods.shop_price}}</view>
            </view>
            <navigator :url="'/pages/team/team_info/team_info?goods_id=' + item.goods_id + '&item_id=' + item.item_id + '&team_id=' + item.team_id">
                <view class="go-team">去开团 ></view>
            </navigator>
        </view>
    </view>
</view>

 <view class="no-data" v-if="!goodlist || goodlist.length == 0">
        <image src="/static/images/cart-null.png" class="cart-image"></image>
        <view class="no-data-title">没有找到相关的记录</view>
        <navigator url="/pages/index/index/index" class="lookat"> 去逛逛 </navigator>
 </view>
</view>
</template>

<script>
// index.js
var app = getApp();
var setting = app.globalData.setting;
import LoadMore from "../../../utils/LoadMore";
var load = new LoadMore();

export default {
  data() {
    return {
      url: setting.url,
      menu: [{
        link: "/pages/goods/search/search",
        src: "/static/images/ico-team1.png",
        cont: "搜索"
      }, {
        link: "/pages/activity/seckill_list/seckill_list",
        src: "/static/images/ico-team2.png",
        cont: "秒杀"
      }, {
        link: "/pages/activity/group_list/group_list",
        src: "/static/images/ico-team3.png",
        cont: "团购"
      }, {
        link: "/pages/goods/brandstreet/brandstreet",
        src: "/static/images/ico-team4.png",
        cont: "品牌街"
      }, {
        link: "/pages/goods/integralMall/integralMall",
        src: "/static/images/ico-team5.png",
        cont: "积分商城"
      }],
      goodlist: null,
      currentPage: 1
    };
  },

  components: {},
  props: {},
  onLoad: function (options) {
    load.init(this, '', 'goodlist');
    this.getFightGroupList();
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    this.reloadGoodList();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    if (load.canloadMore()) {
      this.getFightGroupList();
    }
  },
  methods: {
    getFightGroupList: function () {
      var that = this;
      var requestUrl = '/api/Team/AjaxTeamList?p=' + that.currentPage;
      load.request(requestUrl, function (res) {
        that.currentPage++;
        uni.stopPullDownRefresh();
      });
    },
    //重置数据
    reloadGoodList: function () {
      load.resetConfig();
      this.goodlist = null;
      this.currentPage = 1;
      this.getFightGroupList();
    }
  }
};
</script>
<style>
/* index.wxss */
.menu{
    padding: 20px 0;
    display: flex;
    justify-content: space-around;
    background-color: #fff;
}
.menu-item{
    width: 20%;
    text-align: center;
}
.menu-ico{
    width: 48rpx;
    height: 48rpx;
    margin: 0 auto 12rpx;
}
.menu-cont{
    height: 42rpx;
    font-size: 30rpx;
    line-height: 42rpx;
    overflow: hidden;
    color: #555;
}
.team-list{
    margin-top: 20rpx;
}
.team-item{
    margin: 0 auto;
    padding: 0 0rpx;
    background-color: #fff;
    padding-bottom: 20rpx;
    margin-top: 20rpx;
    width: 710rpx;
    box-sizing: border-box;
    border-radius: 10rpx;
}
.team-pic{
    width: 710rpx;
    height: 300rpx;
}
.team-name{
    font-size: 28rpx;
    line-height: 42rpx;
    max-height: 84rpx;
    margin: 10rpx 0;
    color:#1d1d1d;
    font-weight:600;
    padding: 0 20rpx;
}
.team-des{
    display: flex;
    justify-content: space-between;
    padding: 0 20rpx;
}
.team-price{
    display: flex;
    font-size: 28rpx;
    color: #555;
    align-items: center;
}
.team-price>view{
    margin-right:30rpx;
    font-size:22rpx;
}
.team-ico{
    display: flex;
    align-items: center;
}
.team-price .co-red{
    font-size:34rpx;
    font-weight:600;
}
.team-price .co-red text{
    font-size: 24rpx;
}
.team-ico>view{
    width: 36rpx;
    height: 30rpx;
    margin-right: 6rpx;
}
.go-team{
    font-size: 28rpx;
    padding: 2rpx 10rpx;
    color: #e23435;
    background-color: #fff;
    border-radius: 20rpx;
    border: 1rpx solid #e23435;
}
.no-more{
    text-align: center;
    line-height: 2;
}

</style>